package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.SubstanceListCardBean;
import o.azb;
import o.cgz;
import o.Logger;
import o.dof;
import o.ContentManager;
import o.eqx;
import o.eqz;
import o.erq;
import o.evf;
import o.ewm.c;
import o.ewm.d;
import o.ewm.e;
import o.ewm.j;
import o.fmw;

public class SubstanceListCardAudioItem extends AbstractSubstanceListItemCard implements eqz {
    private View ʼ;
    private TextView ʽ;
    private ImageView ˋ;
    private TextView ॱॱ;
    private TextView ᐝ;

    public SubstanceListCardAudioItem(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (ImageView) view.findViewById(j.ˊʹ);
        this.ʽ = (TextView) view.findViewById(j.ˊי);
        this.ॱॱ = (TextView) view.findViewById(j.ˊٴ);
        this.ʼ = view.findViewById(j.ˉʻ);
        this.ᐝ = (TextView) view.findViewById(j.ㆍʼ);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        SubstanceListCardBean substanceListCardBean = (SubstanceListCardBean) cardBean;
        String str = (String) this.ˋ.getTag();
        if (dof.ˋ(str) || !str.equals(substanceListCardBean.ʻᐝ())) {
            Context ˋ = ContentManager.getInstant().getContext();
            int dimensionPixelSize = ˋ.getResources().getDimensionPixelSize(d.ᐝᐝ);
            int dimensionPixelSize2 = ˋ.getResources().getDimensionPixelSize(d.ॱʻ);
            if (evf.ˊ(this.ˋ)) {
                this.ˋ.setImageDrawable((Drawable) fmw.ˏ(this.ˋ.getContext(), e.ꜞ, "drawable"));
            } else {
                this.ˋ.setImageResource(e.ꜞ);
            }
            this.ʼ.setBackgroundResource(c.ˉ);
            eqx.ˏ(dimensionPixelSize, dimensionPixelSize2, this.ˋ, substanceListCardBean.ʻᐝ(), "image_default_icon", this, true);
            this.ˋ.setTag(substanceListCardBean.ʻᐝ());
            this.ʽ.setText(substanceListCardBean.ʾॱ());
            this.ॱॱ.setText(substanceListCardBean.ʽˊ());
            ˋ(this.ᐝ, substanceListCardBean.ˋʻ());
            ᐝ(this.ॱॱ);
        }
    }

    public void ॱ(Bitmap bitmap) {
        if (bitmap != null) {
            try {
                this.ʼ.setBackground(new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{erq.ˎ(bitmap), 0}));
                boolean ˏ = erq.ˏ(r0);
                int i = -16777216;
                this.ॱॱ.setAlpha(azb.ˋ(this.ʼॱ, d.ߺ));
                if (ˏ) {
                    i = -1;
                    this.ॱॱ.setAlpha(azb.ˋ(this.ʼॱ, d.ॱʿ));
                }
                this.ʽ.setTextColor(i);
                this.ॱॱ.setTextColor(i);
            } catch (IllegalStateException e) {
                Logger.e("SubstanceListCardAudioItem", e.toString());
            }
        }
    }
}
